package com.xmx.ndmallrabbitstarter;


import com.xmx.ndmallrabbitstarter.selector.AmqpSelector;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.core.annotation.Order;

/**
 * @Description: 用一句话描述
 * @Auther: 新梦想*陈超
 * @Date: 2021/9/4 19:38
 */
@Configuration
@Import(AmqpSelector.class)
@ConditionalOnProperty(name = {"spring.amqp.rabbit.enabled"}, matchIfMissing = false, havingValue = "true")
@Order(-1) //默认值为0
@Slf4j
public class AmqpAutoConfig {
    /** 使用JOSON序列化机制，进行消息转换*/
    @Bean
    public MessageConverter messageConverter() {
        return new Jackson2JsonMessageConverter();
    }
}
